home *** CD-ROM | disk | FTP | other *** search
/ Champak 146 / (Vol 146) Jan 07 2012.iso / Games / shark_attack_2.swf / scripts / DefineSprite_40 / frame_1 / DoAction.as
Encoding:
Text File  |  2012-01-07  |  1.3 KB  |  47 lines

  1. x = _X + _parent._x;
  2. y = _Y + _parent._y;
  3. width = _width / 2;
  4. if(x - width < _root.mascot._x && _root.mascot._x < x + width && (y - _root.mascot.jumpspeed < _root.mascot._y + 40 && _root.mascot._y + 40 < y + 20) && _root.mascot.jumping != true)
  5. {
  6.    _root.mascot.air = false;
  7.    _root.mascot._y = y - 40;
  8.    if(mascot != true)
  9.    {
  10.       _root.mascot.platform_contact = _root.mascot.platform_contact + 1;
  11.       mascot = true;
  12.    }
  13.    if(_name == "water" && _root.mascot.water != true)
  14.    {
  15.       _root.mascot.water = true;
  16.       _root.splash._x = _root.mascot._x;
  17.       _root.splash._y = _root.mascot._y;
  18.       _root.splash.play();
  19.    }
  20. }
  21. else if(mascot == true)
  22. {
  23.    if(_root.mascot.platform_contact == 1)
  24.    {
  25.       _root.mascot.air = true;
  26.    }
  27.    _root.mascot.platform_contact--;
  28.    if(_root.mascot.water == true && _root.mascot.jumping == true && _root.splash._currentFrame == 1)
  29.    {
  30.       _root.splash._x = _root.mascot._x;
  31.       _root.splash._y = _root.mascot._y;
  32.       _root.splash.play();
  33.    }
  34.    _root.mascot.water = false;
  35.    mascot = false;
  36. }
  37. if(_name == "water" && (x - width < _root.mascot._x && _root.mascot._x < x + width))
  38. {
  39.    land_check = true;
  40.    _root.mascot.land = false;
  41. }
  42. else if(land_check != false)
  43. {
  44.    _root.mascot.land = true;
  45.    land_check = false;
  46. }
  47.